<template>
  <transition name="fade">
    <div class="header-detail">
      <div class="detail-wrapper">
        <div class="detail-main">
          <div class="name">蜗牛的店</div>
          <!-- 星星 -->
          <div class="star-wrapper"></div>
          <div class="title">
            <div class="line"></div>
            <div class="text">优惠信息</div>
            <div class="line"></div>
          </div>
          <ul class="supports">
            <!-- v-for 里面中的key放数据里面的唯一值 -->
            <li class="supports-item" v-for="(item, index) in seller.supports" :key="index">
              <!-- 使用 -->
              <div class="support">
                <!-- 图标 -->
                <support-ico :size="1" class="ico" :type="item.type"></support-ico>
                <!-- 信息 -->
                <span class="text">{{ item.description }}</span>
              </div>
            </li>
          </ul>
          <div class="title">
            <div class="line"></div>
            <div class="text">商家公告</div>
            <div class="line"></div>
          </div>
          <div class="bulletin">
            <p class="content">{{ seller.bulletin }}</p>
          </div>
        </div>
      </div>
      <div class="detail-close" @click.stop="hide">
        <i class="icon-close"></i>
      </div>
    </div>
  </transition>
</template>

<script>
// 引入
import SupportIco from "../support-ico/support-ico.vue"
export default {
  // 接收到的数据放里面
  props: {
    seller: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  methods: {
    hide() {
      //控制页面消失，要传数据给父组件
      this.$emit("hide", false) //抛出事件
    },
  },
  // 声明
  components: {
    SupportIco,
  },
}
</script>

<style lang="less">
.header-detail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  overflow: hidden;
  background: rgba(7, 17, 27, 0.8);
  color: #fff;
  opacity: 1;
  backdrop-filter: blur(10px);
  .detail-wrapper {
    display: flex;
    width: 100%;
    min-height: 100%;
    .detail-main {
      margin-top: 64px;
      width: 100%;
      .name {
        line-height: 16px;
        text-align: center;
        font-size: 16px;
        font-weight: normal;
      }
      .star-wrapper {
        margin-top: 8px;
        padding: 2px 0;
        text-align: center;
      }
      .title {
        display: flex;
        width: 80%;
        margin: 28px auto 24px auto;
        .line {
          flex: 1;
          border-bottom: 1px solid rgba(255, 255, 255, 0.2);
          transform: translateY(-50%);
        }
        .text {
          padding: 0 12px;
          font-weight: 700px;
          font-size: 14px;
        }
      }
      .supports {
        margin: 0 auto;
        width: 80%;
        .supports-item {
          list-style: none;
          width: 100%;
          .support {
            margin: 12px 0;
            .ico {
              margin-right: 6px;
            }
            .text {
              font-size: 12px;
              line-height: 12px;
            }
          }
        }
        .supports-item:last-child {
          margin-bottom: 0;
        }
      }
      .bulletin {
        margin: 0 auto;
        width: 80%;
        .content {
          font-size: 12px;
          margin: 0 12px;
          line-height: 24px;
        }
      }
    }
  }
  .detail-close {
    position: relative;
    width: 30px;
    height: 30px;
    margin: -64px auto 0 auto;
    font-size: 30px;
  }
}
.fade-enter,
.fade-leave-to {
  opacity: 0;
  background: rgba(7, 17, 27, 1);
}
.fade-enter-active,
.fade-leave-active {
  // 动画进行 0.5s
  transition: all 0.5;
}
</style>
